<?php
/**
 * Unfuddle Account Model
 * All data in Unfuddle is within an account.
 *
 * @package     Unfuddle
 * @subpackage  Data Models
 * @author      Luke Visinoni <luke.visinoni@gmail.com>
 * @copyright   (c) 2010 Luke Visinoni <luke.visinoni@gmail.com>
 * @version     $Id: Account.php 29 2011-05-09 07:08:53Z luke.visinoni $
 */
class Unfuddle_Model_Account extends Unfuddle_Model_Abstract {

    /**
     * Contains very basic, high level information about the Account.
     */
    const URI_ACCOUNT = '/account';
    
    /**
     * The activity for all Projects to which the requesting person has access
     */
    const URI_ACCOUNT_ACTIVITY = '/account/activity';
    
    /**
     * Searches through all projects to which the requester person has access for instances of the given query string
     */
    const URI_ACCOUNT_SEARCH = '/account/search';
    
    /**
     * Resets access keys for the account and for all users within the Account, thus invalidating all RSS and iCal feeds out in the wild
     */
    const URI_RESET_ACCESS_KEYS = '/account/reset_access_keys';
    
    /**
     * A convenience resource that provides many of the top level items in an account in a single call
     */
    const URI_INITIALIZER = '/initializer';
    
    /**
     * A convenience resource that can be used to format text fields that support Markups such as Markdown, Textile or Unfuddle markup conventions (i.e message body, ticket description)
     */
    const URI_FORMATTER = '/account/formatter';
    
    /**
     * @var string The model name
     */
    protected $_name = 'account';
    
    /**
     * @var array The fields this model contains
     */
    protected $_fields = array(
        'access-key' => array('type' => 'text', 'required' => false, 'read-only' => true),
        'created-at' => array('type' => 'datetime', 'required' => false, 'read-only' => true),
        'default-ticket-report-id' => array('type' => 'integer', 'required' => false, 'read-only' => false),
        'default-time-zone' => array('type' => 'text', 'required' => false, 'read-only' => false), // i.e. "Pacific Time (US & Canada)"
        'description' => array('type' => 'text', 'required' => false, 'read-only' => false),
        'disk-usage' => array('type' => 'integer', 'required' => false, 'read-only' => true), // in Kilobytes
        'id' => array('type' => 'integer', 'required' => false, 'read-only' => true),
        'plan' => array('type' => 'set', 'required' => false, 'read-only' => true, 'set' => array('private', 'micro', 'compact', 'corporate', 'enterprise')),
        'subdomain' => array('type' => 'text', 'required' => false, 'read-only' => true),
        'text-markup' => array('type' => 'set', 'required' => false, 'read-only' => false, 'set' => array('markdown', 'textile', 'plain')),
        'title' => array('type' => 'text', 'required' => false, 'read-only' => false),
        'updated-at' => array('type' => 'datetime', 'required' => false, 'read-only' => true),
        /**
         * the following is read-only and describes the feature set of an account
         * @todo Unfuddle_Model_Abstract doesn't currently support these...
         */
        'features.attachments' => array('type' => 'boolean', 'required' => false, 'read-only' => true),
        'features.ssl' => array('type' => 'boolean', 'required' => false, 'read-only' => true),
        'features.storage' => array('type' => 'boolean', 'required' => false, 'read-only' => true),
        'features.time-tracking' => array('type' => 'boolean', 'required' => false, 'read-only' => true),
    );

}
